﻿//  Copyright (c) Microsoft Corporation.  All rights reserved.

namespace TFSAccess
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using Microsoft.TeamFoundation;
    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.Framework.Client;
    using Microsoft.TeamFoundation.WorkItemTracking.Client;

    internal class WorkItemGenerator : NotifyPropertyChange
    {
        #region Fields

        private string m_serverName;
        private string m_projectName;
        private string m_workItemTypeName;
        private WorkItemLinkTypeEndCollection m_workItemLinkTypeEndCollection;
        private WorkItem m_linkingTask;

        #endregion

        #region Constants

      





        #endregion

        #region Constructor

        public WorkItemGenerator(string serverName, string projectName)
        {
            if (string.IsNullOrEmpty(serverName))
            {
                throw new ArgumentNullException("serverName", "servername is null");
            }
            if (string.IsNullOrEmpty(projectName))
            {
                throw new ArgumentNullException("projectName", "projectName is null");
            }


            // Get the Test Management Service
            ITfsTeamProjectCollectionObject service = (ITfsTeamProjectCollectionObject)TeamProjectCollection.GetService(typeof(WorkItemStore));

            //// Initialize the TestManagement Team Project
            //m_teamProject = (ITestManagementTeamProject)service.GetTeamProject(projectName);

            //ILocationService locationService = TeamProjectCollection.GetService<ILocationService>();


        }

        #endregion

        #region Properties


        /// <summary>
        /// TFS Server Collection URL
        /// </summary>
        public string Server
        {
            get
            {
                return m_serverName;
            }
            private set
            {
                m_serverName = value;
                NotifyPropertyChanged("Server");
            }
        }

        /// <summary>
        /// TFS Project Name
        /// </summary>
        public string Project
        {
            get
            {
                return m_projectName;
            }
            private set
            {
                m_projectName = value;
                NotifyPropertyChanged("Project");
            }
        }

        public IList<string> LinkTypeNames
        {
            get;
            private set;
        }

        /// <summary>
        /// List of Name of WorkItem types
        /// </summary>
        public IList<string> WorkItemTypeNames
        {
            get;
            private set;
        }

      



        /// <summary>
        /// Default work item type in the selected workitem category
        /// </summary>
        public string DefaultWorkItemTypeName
        {
            get;
            private set;
        }

        /// <summary>
        /// Work Item Type of the TFS workitems to generates
        /// </summary>
        public string SelectedWorkItemTypeName
        {
            get
            {
                return m_workItemTypeName;
            }
            set
            {
                m_workItemTypeName = value;
                NotifyPropertyChanged("SelectedWorkItemTypeName");
            }
        }



        /// <summary>
        /// TfsTeamProjectCollection object
        /// </summary>
        public TfsTeamProjectCollection TeamProjectCollection
        {
            get;
            private set;
        }

        #endregion

       

    }
}